//
//  MCUpdateGoodsCategoryCell.swift
//  StoreManage
//
//  Created by MC on 2018/9/12.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCUpdateGoodsCategoryCell: UICollectionViewCell {
    
    var model = MCGoodsCategoryModel() {
        didSet {
            nameLabel.text = model.name
            
            if model.isContains.intValue == 0 {  // 该分类不包含该商品，不选中
                self.layer.borderColor = UIColor.MCGray_middle.cgColor
                self.backgroundColor = UIColor.MCGray_light
                nameLabel.textColor = UIColor.MCWords
            } else {
                nameLabel.textColor = UIColor.MCMain
                self.layer.borderColor = UIColor.MCMain.cgColor
                self.backgroundColor = MCColor_16(colorStr: "FFF5F9")
            }
        }
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.layer.cornerRadius = 3
        self.layer.masksToBounds = true
        self.layer.borderWidth = 1

        
        
        self.addSubview(nameLabel)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        nameLabel.snp.remakeConstraints { (make) ->Void in
            make.edges.equalTo(self)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    lazy var nameLabel: MCLabel = {
        let label = MCLabel()
        label.font = MCFont(14)
        label.text = "洗漱用品"
        label.textAlignment = NSTextAlignment.center
        return label
    }()
}
